#ifndef ROBOT_CLEANER_H
#define ROBOT_CLEANER_H

#include <string>
// 位姿表示
enum Direction { NORTH, EAST, SOUTH, WEST };

class Position {
public:
    int x;
    int y;
    Direction d;

public:
    Position(int x = 0, int y = 0, Direction d = NORTH);
    bool operator==(const Position& p) const;
    Position forwardStep(int setp);
    Position backwardStep(int setp);
};

// 命令表示
enum CommandType { TURN_LEFT, TURN_RIGHT, FORWARD, BACKWARD, ROUND };

class Command {
public:
    virtual void execute(Position& position) = 0;
    virtual ~Command() = default;
};

// 命令工厂
class CommandFactory {
public:
    static Command* createCommand(const CommandType type);
};

// RobotCleaner
class RobotCleaner {
private:
    Position position;

public:
    RobotCleaner(int x = 0, int y = 0, Direction d = NORTH);
    void executeCommand(Command*& command);
    Position getPosition() const;
};

#endif  // ROBOTCLEANER_H
